package net.sxnic.ugr.dept.action;



@SuppressWarnings("serial")
public class GetDeptSelect extends DeptAction {
	
	private String dutyflagHtml;
	
	private String bkhdwType;
	
	private String bkhdwId;
	
	public String execute() throws Exception {
		
//		try {
//
//			System.out.println("bkhdwType=" + bkhdwType);
//
//			List<Dept> dList = deptManager.findByCtype(bkhdwType, "2011");
//
//			HttpServletResponse response = ServletActionContext.getResponse();
//			PrintWriter out = response.getWriter();
//			response.setContentType("application/xml;charset=UTF-8");
//
//			out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
//
//			out.write("<root><node value=\"\" text=\"" + GBK2Unicode2("请选择")
//					+ "\"/>");
//
//			for (Dept d : dList) {
//				if (StringUtils.isNotBlank(bkhdwId)
//						&& bkhdwId.equals(d.getId()))
//					out.write("<node value=\"" + d.getId()
//							+ "\" selected=\"selected\" text=\""
//							+ GBK2Unicode2(d.getName()) + "\"/>");
//				else
//					out.write("<node value=\"" + d.getId()
//							+ "\" selected=\"\" text=\""
//							+ GBK2Unicode2(d.getName()) + "\"/>");
//			}
//
//			out.write("</root>");
//
//		} catch (Exception e) {
//			e.printStackTrace();
//		}

		
		return SUCCESS;
	}
	
	private static String GBK2Unicode2(String str){
		StringBuffer result = new StringBuffer();
		for (int i = 0; i < str.length(); i++){
		char chr1 = (char)str.charAt(i);
		result.append("&#" + Integer.toString((int)chr1)+ ";");  
		}         
		return result.toString();
	}
	
	public String getDutyflagHtml() {
		return dutyflagHtml;
	}

	public void setDutyflagHtml(String dutyflagHtml) {
		this.dutyflagHtml = dutyflagHtml;
	}

	public String getBkhdwType() {
		return bkhdwType;
	}

	public void setBkhdwType(String bkhdwType) {
		this.bkhdwType = bkhdwType;
	}

	public String getBkhdwId() {
		return bkhdwId;
	}

	public void setBkhdwId(String bkhdwId) {
		this.bkhdwId = bkhdwId;
	}


}
